<template>
	<view class="container">
		<view class="recordList">
			<view class="recordItem" v-for="item in recordList" :key="item.id">
				<view class="refundHd">编号：{{item.refund_no}}<span @click="copy(item.refund_no)" class="copy">复制</span></view>
				<view class="con">
					<view class="source">客户编码：{{item.refunder.spread_code}}</view>
					<view class="price">单价：￥{{item.goods_price}}</view>
					<view class="num">数量：{{item.refund_num}}</view>
					<view class="time">时间：{{item.create_time}}</view>
				</view>
				<view class="footer">
					<view class="amount">
						<view class="status">{{item.status_label}}</view>总金额：￥{{item.amount}}
					</view>
				</view>
			</view>
		</view>
		<u-loadmore :status="status" />


	</view>
</template>

<script>
	import {
		stockAuditList
	} from "@/common/api.js";
	export default {
		components: {},
		data() {
			return {
				page: 1,
				status: 'loadmore',
				recordList: []
			};
		},
		onLoad() {
			this.selectOrder()
		},
		onReachBottom() {
			this.selectOrder()
		},
		methods: {
			copy(text){
				uni.setClipboardData({
					data:text
				})
			},

			selectOrder() {
				if (this.status !== 'loadmore') {
					return
				}
				this.status = 'loading'
				stockAuditList(this, {
					page: this.page
				}, (res) => {
					this.$set(this, 'recordList', [...this.recordList, ...res])
					this.page++
					this.status = 'loadmore'
					if (res.length === 0) {
						this.status = 'nomore'
					}
				})
			}
		}
	};
</script>
<style lang="scss">
	page {
		font-family: PingFang SC;
		background-color: #F6F6F6;
		height: 100%;
	}

	.recordItem {
		margin: 15rpx 15rpx 25rpx 15rpx;
		border-radius: 15rpx;
		background-color: #FFFFFF;
		padding: 15rpx;
		position: relative;

		.con {
			.source {
				height: 60rpx;
				line-height: 60rpx;
			}

			.num {
				font-size: 12px;
				color: #999999;
				height: 40rpx;
				line-height: 40rpx;
			}

			.time {
				font-size: 12px;
				color: #999999;
				height: 40rpx;
				line-height: 40rpx;
			}
		}

		.footer {
			border-top: 1rpx solid #efefef;
			color: #999999;
			line-height: 60rpx;
			text-align: right;
			padding: 15rpx;

			.status {
				float: left;
				color: #333333;
			}

			.amount {
				overflow: hidden;
			}

			.btns {
				overflow: hidden;
			}

			.btn {
				font-size: 12px;
				border: 1rpx solid #d5d5d5;
				display: inline-block;
				border-radius: 10rpx;
				float: right;
				margin-left: 20rpx;
				padding: 0 15rpx;
				line-height: 50rpx;
			}
		}
	}
	.copy{
		margin-left: 30rpx;
	}
</style>